<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改巡检点')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-dian-edit" th:object="${fzInspectionDian}">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">巡检点id：</label>
                <div class="col-sm-8">
                    <input name="cId" th:field="*{inspectionId}" readonly="readonly" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">设备名称：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{name}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">位置：</label>
                <div class="col-sm-8">
                    <input name="position" th:field="*{position}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">经度：</label>
                <div class="col-sm-8">
                    <input name="along" id="along"  th:field="*{along}" readonly="readonly"  style="width:430px;display: inline" class="form-control" type="text" required>
                    <span style="margin-left: 30px" onclick="editFullWei()" class="fa fa-map-pin"></span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">纬度：</label>
                <div class="col-sm-8">
                    <input name="latitude" readonly="readonly" id="latitude" th:field="*{latitude}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" th:field="*{remark}"  class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "inspection/dian";
        $("#form-dian-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-dian-edit').serialize());
            }
        }


        function editFullWei(){
            var yi1=($("#along").val()==null || $("#along").val()=="" )?"1":$("#along").val();
            var er1=($("#latitude").val()==null || $("#latitude").val()=="")?"1":$("#latitude").val();
            var index = layer.open({
                type: 2,
                area: [800+ 'px', ($(window).height() - 50) + 'px'],
                fix: false,
                //不固定
                maxmin: true,
                shade: 0.3,
                title: "修改巡检点",
                content: prefix+"/editDian?along="+yi1+"&latitude="+er1,
                btn: ['确定', '关闭'],
                // 弹层外区域关闭
                shadeClose: true,
                yes: doSubmit,
                cancel: function(index) {
                    return true;
                },
                callBack: doSubmit
            });
            layer.full(index);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var yi=body.find('#along').val();
            var er=body.find('#latitude').val();
                $("#along").val(yi);
                $("#latitude").val(er);
            layer.close(index);
        }
    </script>
</body>
</html>